package com.service.impl;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.base.PageBean;
import com.bean.ParkOrder;
import com.bean.ParkStatBean;
import com.bean.Parkinfo;
import com.dao.ParkStatDao;
import com.service.ParkStatService;
import com.tool.RegexTool;

public class ParkStatServiceImpl implements ParkStatService {
	ParkStatDao dao;
	private Logger log = Logger.getLogger(PayStatisticsServiceImpl.class);
	public ParkStatDao getDao() {
		return dao;
	}

	public void setDao(ParkStatDao dao) {
		this.dao = dao;
	}

	@Override
	public String queryByDayo(List<Parkinfo> payInOut,
			List<Parkinfo> payStat, String daytime, Long userId)
			throws Exception {
		if(RegexTool.checkDateTime(daytime)){
			return dao.queryByDayo(payInOut, payStat, daytime, userId);
		}else{
			return "日期错误";
		}
	}

	@Override
	public Long[][] queryByWeeko(List<Parkinfo> payInOut,
			List<Parkinfo> payStat, Map<Double, Double> paylistInOutByDay,
			String weektime, Long userId) throws Exception {
		if(RegexTool.checkDateTime(weektime)){
			return dao.queryByWeeko(payInOut, payStat, paylistInOutByDay, weektime, userId);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	@Override
	public Long[][] queryByMontho(List<Parkinfo> payInOut,
			List<Parkinfo> payStat, Map<Double, Double> paylistInOutByDay,
			String daytime, Long userId) throws Exception {
		if(RegexTool.checkMonth(daytime)){
			return dao.queryByMontho(payInOut, payStat, paylistInOutByDay, daytime, userId);
		}else{
			return null;// "日期错误";
		}
	}

	@Override
	public Long[][] queryByYearo(List<Parkinfo> payInOut,
			List<Parkinfo> payStat, Map<Double, Double> paylistInOutByMonth,
			String daytime, Long userId) throws Exception {
		if(RegexTool.checkYear(daytime)){
			return dao.queryByYearo(payInOut, payStat, paylistInOutByMonth, daytime, userId);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	@Override
	public List<ParkStatBean> moneylist(String dateTime, PageBean page,ParkOrder order) {
		return dao.moneylist(dateTime, page, order);
	}

	@Override
	public List<ParkStatBean> moneylistzhou(String dateTime, PageBean page,
			ParkOrder order) throws Exception{
		return dao.moneylistzhou(dateTime, page, order);
	}
}
